/**
 * @ Author: luoqi
 * @ Create Time: 2024-03-09 00:00
 * @ Modified by: luoqi
 * @ Modified time: 2024-04-02 23:50
 * @ Description:
 */

#define DBG_TAG "BLC"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "blc.h"

static struct rt_device_pwm *pwm3 = RT_NULL;

static BlcObj blc;

int blc_init()
{
    memset(&blc, 0, sizeof(BlcObj));
    pwm3 = (struct rt_device_pwm *)rt_device_find("pwm3");
    if(pwm3 == RT_NULL)
    {
        LOG_E("Can't find pwm3 device!");
        return -1;
    }
    rt_pwm_set(pwm3, 1, 100000, 50000);
    rt_pwm_set(pwm3, 2, 100000, 50000);
    rt_pwm_enable(pwm3, 1);
    rt_pwm_enable(pwm3, 2);
    return 0;
}

BlcObj *blc_get()
{
    return &blc;
}
